// workflow tables definition


var CultureMuncher_Workflow_TableDefinition = function(name, tableName, columns, isLookup, drawFunction) {
	this.columns = columns;
	this.name = name;
	this.tableName = tableName;
	this.isLookup = isLookup;
	this.draw = drawFunction;
};

var CultureMuncher_wfTableLine = function(name, type, defaultValue, parseAction, updateAction) {
	this.name = name;
	this.defaultValue = defaultValue;
	this.type = type;
	this.updateAction = updateAction;
};

var CultureMuncher_wfTableParent = function(name, id, strict) {
	this.name = name;
	this.id = id;
	this.strict = strict;
};

CultureMuncher_Workflow_TableDefinition = {
	venue: new CultureMuncher_Workflow_TableDefinition(
		'Venue', 'Venue',
		new Array(
		new CultureMuncher_wfTableLine("Name"),
		new CultureMuncher_wfTableLine("Address"),
		new CultureMuncher_wfTableLine("Street"),
		new CultureMuncher_wfTableLine("City"),
		new CultureMuncher_wfTableLine("Zip"),
		new CultureMuncher_wfTableLine("Country"),
		new CultureMuncher_wfTableLine("Description"),
		new CultureMuncher_wfTableLine("TicketInfo"),
		new CultureMuncher_wfTableLine("Tel"),
		new CultureMuncher_wfTableLine("Fax"),
		new CultureMuncher_wfTableLine("E-Mail"),
		new CultureMuncher_wfTableLine("Info1"),
		new CultureMuncher_wfTableLine("Info2"),
		new CultureMuncher_wfTableLine("Info3"),
		new CultureMuncher_wfTableLine("DisabledAccess"),
		new CultureMuncher_wfTableLine("Parking"),
		new CultureMuncher_wfTableLine("ParkingInfo"),
		new CultureMuncher_wfTableLine("AccessBus"),
		new CultureMuncher_wfTableLine("AccessMetro"),
		new CultureMuncher_wfTableLine("AccessTram"),
		new CultureMuncher_wfTableLine("AccessCar"),
		new CultureMuncher_wfTableLine("AccessTrain")),
		false,
		new function(ctrl) {
			//alert('draw venue');
		}
		),
	venuelookup: new CultureMuncher_Workflow_TableDefinition(
		'Venue Lookup', 'Venue',
		new Array(
		new CultureMuncher_wfTableLine("Name"),
		new CultureMuncher_wfTableLine("City")),
		true),
	venueLocation: new CultureMuncher_Workflow_TableDefinition(
		'Venue Location', 'VenueLocation',
		new Array(
		new CultureMuncher_wfTableParent('Venue', 'Id', true),
		new CultureMuncher_wfTableLine('Name'),
		new CultureMuncher_wfTableLine('Description')),
		false,
		new function(ctrl) {
			//alert('draw venue location');
		}),
	_event: new CultureMuncher_Workflow_TableDefinition(
		'Event', 'Event',
		new Array(
		new CultureMuncher_wfTableParent('Venue', 'Id', true),
		new CultureMuncher_wfTableParent('VenueLocation', 'Id', false),
		new CultureMuncher_wfTableLine('Name'),
		new CultureMuncher_wfTableLine('EventType'),
		new CultureMuncher_wfTableLine('Genre'),
		new CultureMuncher_wfTableLine('DateStart'),
		new CultureMuncher_wfTableLine('DateEnd'),
		new CultureMuncher_wfTableLine('PriceStart'),
		new CultureMuncher_wfTableLine('PriceEnd')),
		false,
		new function(ctrl) {
			//alert('event');
		}),
	concert: new CultureMuncher_Workflow_TableDefinition(
		'Concert', 'Concert',
		new Array(
		new CultureMuncher_wfTableParent('Event', 'Id', true),
		new CultureMuncher_wfTableLine('Performer'),
		new CultureMuncher_wfTableLine('Genre'),
		new CultureMuncher_wfTableLine('Description')),
		false,
		new function(ctrl) {
			//alert('concert');
		}),
	factory: function(name) {
		switch (name.toLowerCase()) {
			case 'venue':
				return this.venue;
			case 'venuelookup':
				return this.venuelookup;
			case 'venuelocation':
				return this.venueLocation;
			case 'event':
				return this._event;
			case 'concert':
				return this.concert;
		}
	},
}